﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pipes.Queries.Model.Query
{
  public class SimpleDeclaration : Parser.IQueryVisitable
  {
    public Identifier Alias { get; set; }
    public IExpression Expr { get; set; }

    public override string ToString()
    {
      return this.Expr.ToString() + (this.Alias ==  null || string.IsNullOrEmpty(this.Alias.ToString()) ? "" : " AS " + this.Alias.ToString());
    }

    public virtual void Visit(Parser.IQueryVisitor visitor)
    {
      visitor.Visit(this);
    }
  }
}
